package edu.pku.sei.act.actools.util;

import android.util.Log;

public class TaskMessage {

	String taskName;
	String sender;
	String receiver;
	String topic;
	String content;
	
	public String toString() {
		return ACToolsNamingSpace.EnvInfo.TASK_MESSAGE + "," + taskName + "," + sender + "," + receiver + "," + topic + "," + content;
	}
	
	public TaskMessage() {
		taskName = "null";
		sender = "null";
		receiver = "null";
		topic = "null";
		content = "null";
	}
	
	public TaskMessage(String taskName, String sender, String receiver,
			String topic, String content) {
		super();
		this.taskName = taskName;
		this.sender = sender;
		this.receiver = receiver;
		this.topic = topic;
		this.content = content;
	}
	
	public TaskMessage(String envInfo) {
		String[] ss = envInfo.split(",");
		if (ss.length != 6){
			Log.e("TaskMessage<init>","wrong envInfo:" + envInfo);
			return ;
		}
		taskName = ss[1];
		sender = ss[2];
		receiver = ss[3];
		topic = ss[4];
		content = ss[5];
	}

	public String getTaskName() {
		return taskName;
	}
	public void setTaskName(String taskName) {
		this.taskName = taskName;
	}
	public String getSender() {
		return sender;
	}
	public void setSender(String sender) {
		this.sender = sender;
	}
	public String getReceiver() {
		return receiver;
	}
	public void setReceiver(String receiver) {
		this.receiver = receiver;
	}
	public String getTopic() {
		return topic;
	}
	public void setTopic(String topic) {
		this.topic = topic;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public TaskMessage clone(){
		return new TaskMessage(toString());
	}
}
